import java.io.IOException;
import java.util.ArrayList;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;


public class Starter
{
	public static void main(String[] args) throws JAXBException, IOException
	{
		createStudents();
	}
	
	private static void createStudents() throws JAXBException, IOException
	{
		// create student
		Student koray = new Student();
		
		koray.setVorname("Koray");
		koray.setNachname("???");
		koray.setMatrikelnummer("1337");
		koray.setGruppe("2172....");
		koray.getAnwesends().add(new Anwesend(true));

		// create student
		Student tim = new Student();
		
		tim.setVorname("Tim");
		tim.setNachname("Gerlach");
		tim.setMatrikelnummer("42");
		tim.setGruppe("2172....");
		tim.getAnwesends().add(new Anwesend(true));
		
		
		Vorlesungsgruppe vorlesungsgruppe = new Vorlesungsgruppe();
		
		vorlesungsgruppe.getStudentenListe().add(koray);
		vorlesungsgruppe.getStudentenListe().add(tim);
	
		// create JAXB context and instantiate marshaller
		JAXBContext context = JAXBContext.newInstance(Vorlesungsgruppe.class);
		Marshaller m = context.createMarshaller();
		m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
		m.marshal(vorlesungsgruppe, System.out);

//		Writer w = null;
//		try
//		{
//			w = new FileWriter(BOOKSTORE_XML);
//			m.marshal(bookstore, w);
//		}
//		finally
//		{
//			try
//			{
//				w.close();
//			}
//			catch (Exception e)
//			{
//			}
//		}
	}
}
